package cn.ulc.socket.admin.controller;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import cn.ulc.common.model.param.PaginationParam;
import cn.ulc.common.util.Result;
import cn.ulc.socket.admin.model.dto.member.WxUserListDTO;
import cn.ulc.socket.admin.service.member.WxUserServ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.Min;

@Validated
@RestController
@RequestMapping(value = "/wxUsers")
public class WxUserCtrl {

    private static final Log log = LogFactory.get();

    @Autowired
    WxUserServ wxUserServ;

    @GetMapping
    public Result findList(String key, PaginationParam pager) {
        WxUserListDTO dto = wxUserServ.findList(key,pager);
        return Result.success(dto);
    }
    @GetMapping("/{id}")
    public Result findDetail(@PathVariable @Min(1) Long id) {
        return Result.success(wxUserServ.findDetail(id));
    }

    @DeleteMapping("/{id}")
    public Result deleted(@PathVariable @Min(1) Long id){
        return Result.success(wxUserServ.deleted(id));
    }

}
